<?php

if(is_null($_GET['productId'])){
header( 'Location:index.php' ) ;
}

$productId = $_GET['productId'];

$host="localhost"; // Host name 
$username="hambaaco_app"; // Mysql username  
$password="sdfsiJdsf435jf"; // Mysql password 
$db_name="hambaaco_tshirts"; // Database name 

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// To protect MySQL injection (more detail about MySQL injection)
$productId = stripslashes($productId);
$productId = mysql_real_escape_string($productId);

$sql="select p2.id_product,p2.colour from products p1 inner join products p2 on p1.id_category=p2.id_category where p1.id_product=".$productId;

$prod_details_sql = "select p1.id_product,p1.nm_product,p1.desc_product,p1.price from products p1 where p1.id_product= ".$productId;

$result_colours=mysql_query($sql);

$result_product=mysql_query($prod_details_sql);

$row = mysql_fetch_array($result_product);



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Merchandise :: Hambaa.com</title>
<link rel="stylesheet" type="text/css" href="styles/Graphitti_style.css" />
<!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">


</script>-->
<script type="text/javascript" src="jquery.min.js"></script>

<script type="text/javascript" src="javascript/cart.js"></script>

<style>
		.black_overlay{
			display: none;
			position: fixed;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: black;
			z-index:1001;
			-moz-opacity: 0.8;
			opacity:.50;
			filter: alpha(opacity=80);
		}
		.white_content {
			display: none;
			position: fixed;
			top: 25%;
			left: 25%;
			width: 50%;
			height: 50%;
			padding: 16px;
			border: 16px solid orange;
			background-color: white;
			z-index:1002;
			overflow: auto;
		}
</style>
<style type="text/css">
#gallery {
margin: 0px; 
width: 100%; 
overflow: hidden;
padding: 0px;
}
#gallery li {
float: left; 
margin: 0 0px 0px 0; 
width: 250px; 
height: 252px; 
position: relative; 
color: #FFFS;
}
#gallery li img {padding: 1px;
background: #ececec; 
border: 1px solid #ccc;
}
#gallery li h3 {
font:  18px ;
color:#FFF;
padding: 0;
margin: 0;
}
#gallery li span {
display: none; 
font-size: 14px; 
position: fixed; 
bottom: 10px; 
right: 7px; 
padding: 5px; 
background-image:url(bg_black_trans.png);
width: 235px; 
line-height: 1.2em;
}
</style>
<script type="text/JavaScript">
$(document).ready(function() {
	$('#gallery li').hover(
		function(){$('span',this).slideToggle('medium');},
		function(){$('span',this).slideToggle('medium');
     });
});

</script>

<script src="jquery.js"></script>
<script>


 $(document).ready(function(){
	 $("#addtocart").click(function(){	
var qty=document.getElementById('qty').value;
var size=document.getElementById('size').value;
//alert(qty);
$.ajax({url:"rest/data/addtoCart.php",
type:'GET',
data : {productId:'<?php echo $row['id_product']?>',quantity:qty,productName:'<?php echo $row['desc_product']?>',rate:'<?php echo $row['price'] ?>',size:size},
success:function(result){
	//alert('hola:' + result);
	if(result ){
		//alert('ooop');
document.getElementById('light').style.display='block';
document.getElementById('fade').style.display='block';

var addmsg="'<font color='#FF0000'><?php echo $row['desc_product']?></font>' has been added to your cart";
getShoppingCart(addmsg);
	}
	
$("#div-id").html(result);
},
error:function(result){
	alert("error");
	

}
});
});
});

</script>

</head>

<body>
<table id="containertable" cellpadding="0" cellspacing="0" border="0" width="950" align="center" >
<tr>
<td align="right">
	<div id="menulinks">
   
    <a href="index.php" class="active">Home</a>
    <a href="offers.php">Offers</a>
	<a href="about_us.php">About Us</a>
	<a href="contact_us.php">Contact Us</a>
    
    </div>

</td>
</tr>

</table>



<table  border="0" align="center" width="952" height="118" background="images/round_back1.png"  >
<tr>
<td width="121" height="114" align="right" valign="bottom">

<a href="index.php"><img src="images/logopng.png" width="103" height="99"  /></a></td>
<td width="819" align="left" valign="top">
<a href="index.php"><img src="images/hambaa_logo_newjpg.jpg" width="308" height="107" /></a>
</td>

</tr>
</table>


<table id="hotitem_cart" border="0" width="950"  align="center" bgcolor="#FFFFFF" >
<tr>
<td width="8"></td>
<td width="369">
Order for your tshirt from our wide range.<br>
What's better, now you can create your own design! 
</td>
<td width="164"><img src="images/hot_items.png" width="164" height="61" /></td>
<td width="56">
        <img src="images/tshirts/ts1.jpg" height="55" width="55" />
</td>
        <td width="56">
        <img src="images/tshirts/ts2.jpg" height="55" width="55" />
        </td>
        <td width="56">
        <img src="images/tshirts/ts3.jpg" height="55" width="55" />
        </td>
         <td width="56">
        <img src="images/tshirts/ts4.jpg" height="55" width="55"  />
        </td>

<td  align="right" width="147">

<a href = "javascript:void(0)" class="cartbtn" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';getShoppingCart()"><table border="0"><tr><td><img src="images/shopping_cart1.png" width="41" height="41" /></td>
<td>Cart(<span  id="order_count"></span>)</td></tr></table></a>

		<div id="light" class="white_content" >
        <div id="close_button" style="position:fixed;width:inherit;float:right" >
        <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"   ><img src="images/Close-button.png"  /></a></div>
        
 
 			<div id="table_container" style="overflow:auto" >
<!--            this is where the table is created -->
             
            </div>
         
            
 
        
        
        
        </div>

		<div id="fade" class="black_overlay" >
        
        </div>
</td>
</tr>

</table>


<table id="outertable" border="0" width="950" height="269" align="center" bgcolor="#FFFFFF" >

<tr >
<td id="tshirt_image" width="250" valign="top">
<ul id="gallery">
            <li>
			<img  src="images/tshirts/ts<?php echo $productId ?>.jpg" />
			<span  style="color:#FFF;   font-size:13px;  font-family:Tahoma, Geneva, sans-serif">Available in following colors</span>
	  </li>
      </ul>
      
	  <center>
      <table border="0" height="58">
      <tr valign="middle">
      <?php
      while($row_colors = mysql_fetch_array($result_colours))
	  {
	  if($productId==$row_colors['id_product'])
  	  echo '<td  background="images/tshirts/colors/active.jpg">';
      else
	  echo '<td>'
	  ?>
      
      <a href="details.php?productId=<?php echo $row_colors['id_product']; ?>">  
      <img  src="images/tshirts/colors/<?php echo $row_colors['colour']; ?>.png"/>
      </a>
      </td>
	  <?php
	  }
	  ?>
      </tr>
      </table>
	  </center>
      </td>
      
<td width="478" valign="top">
    
    <table id="tshirt_info" border="0"  align="center"  cellspacing="2" width="100%" >
    <tr><td colspan="3"><h1><?php echo $row['desc_product'] ?></h1>
    </td></tr>
    <tr>
    <td colspan="3">Price: <strike>Rs. <?php echo $row['price'] +50?></strike> <font color="#FF0000" size="6">Rs. <?php echo $row['price'] ?></font>
    </td></tr>
    <tr>
    <td width="47%">Discount: Rs. 50 <font color="#FF0000" >(<?php echo round(50/$row['price']*100) ?>% Off)</font><br>(Prices are inclusive of all taxes)</td>
    <td width="18%"><h4>In Stock</h4></td>
    <td width="35%">Delivered in 7-10 business days</td>
    </tr>
    <tr>
    <td><h5>Free Shipping</h5></td>
    
	<td>Size: 
		   <select id="size">
           <option value="2">S</option>
           <option value="3">M</option>
           <option value="4" selected="selected">L</option>
           <option value="5">XL</option>
           </select>
    </td>
	<td>Quantity: 
		   <select id="qty">
  		   <option value="1" selected="selected">1</option>
           <option value="2">2</option>
           <option value="3">3</option>
           <option value="4">4</option>
           <option value="5">5</option>
           </select>
    </td>
	</tr>    
    <tr><td align="center">
    <a href = "javascript:void(0)" id="addtocart" class="wishbtn" onclick = "#">
     Add to Cart</a></td>
    <td align="left" colspan=""><img src="images/separator.png" /></td>
    <td>Payment Option: Cash On Delivery</td>
    </tr>
    
    <tr>
    <td align="center">
    <span style="background-color:#0099CC;  padding:5px">
    <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';getShoppingCart()"> View Cart </a></span>
    <td colspan="2" align="center">


<span style="background-color:#0099CC;  padding:5px">
<a href="mywishlist.php?productId=<?php echo $row['id_product']?>&timefilter=all" id="addtomywishlist"> + Add to My Wishlist</a></span>
    
    </td>
    
    
    <tr><td colspan="3">
    <div id="div-id">&nbsp;</div>
    </td></tr>
    </table>
<hr />    
</td>
<td width="200" valign="top">
		<table id="innerright" border="0" cellspacing="2"  width="200" align="right" background="images/tableback3.png" >
		<tr><td height="176"><img src="images/5star.png" /><h3>Recommended for you</h3></td></tr>
 		    
       <tr><td align="center" bgcolor="#FFFFFF" valign="middle">
    <a href = "mywishlist.php?timefilter=all" class="wishbtn" > My Wishlist</a><br><br>
    </td></tr>
    
     <tr><td bgcolor="#FF6666">

    <h6>We'd like to hear from you</h6>
    </td></tr>

	<tr align="center" ><td align="center"> 
    <h2><a href="suggest.php">Make your Suggestion</a></h2>
    
    </td></tr>
  
   
    </table>
</td>

</tr>


<tr >
<td colspan="2" align="right">

    <table border="0" bordercolor="#0000FF" id="tshirt_description" cellpadding="5">
        <tr>
        
        <td  valign="top" width="93"><h6><span style="background-color:#999;padding:3px;">Description :</span> </h6></td>
        <td width="474">
        Order for your tshirt from our wide range.What's better, now you can create your own design! Order for your tshirt from our wide range.What's better, now you can create your own design! 
         </td>
         </tr>
         <tr>
         <td  valign="top" width="93"><h6><span style="background-color:#666;padding:3px;">Sleeve :</span> </h6></td>
        <td>
        Half
         </td>
         </tr>
         
         <tr>
         <td  valign="top" width="93"><h6><span style="background-color:#666;padding:3px;">Size :</span> </h6></td>
        <td>
        M
         </td>
         </tr>
         
         <tr>
        
        <td  valign="top" width="93"><h6><span style="background-color:#666;padding:3px;">Description :</span> </h6></td>
        <td width="474">
        Order for your tshirt from our wide range.What's better, now you can create your own design! Order for your tshirt from our wide range.What's better, now you can create your own design! 
         </td>
         </tr>
    </table>


<td></td>

</td>
</tr>
</table>


<table width="952" align="center" border="0" background="images/round_back2.png" height="58" >
<tr>
<td></td>
</tr>

</table>

 



<br />






<div id="footer" > 


<table border="0" width="952" height=154 align="center" >
<tr>
<td >
<h1>My Hambaa</h1>
</td>
<td >
<h1>Shopping Policies</h1>













</td>
<td >
<h1>Payment Information</h1>
</td>
<td >
<h1>Contact Us</h1>
</td>
</tr>

<tr>
<td>
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';getShoppingCart()">My Cart</a> |
<a href="about_us.php">My Order</a> |
<a href="about_us.php">FAQs</a>
</td>

<td >
<a href="about_us.php">Return Policy</a> |
<a href="about_us.php">Refund Policy</a> |
<a href="about_us.php">Terms and Conditions</a>
</td>

<td >
<a href="about_us.php">Payment Options: </a>COD
</td>

<td >
e-mail:
<a href="mailto:care@hambaa.com">care@hambaa.com</a>
</td>
</tr>

<tr align="center"><td colspan="4">
<hr />

&copy;2012 All Rights Reserved by <a href="index.php">www.hambaa.com</a>
</td></tr>
</table>
</div>
</body>
</html>
